<?php
namespace Home\Controller;
use Think\Controller;

class UcvipbuyController extends  BaseController
{
	public function index(){
		
		$root = get_baseroot();
		
		$user =  $GLOBALS['user_info'];
		$root['session_id'] =\es_session::id();
		$user_id  = intval($user['id']);
		if ($user_id >0){
			
			$root['user_login_status'] = 1;		
			$root['response_code'] = 1;
			
			$vip_id = intval($user['vip_id']);
			
			$vip_list =  load_auto_cache("vip_list");
        
			$now_vip_grade = $vip_list[$vip_id];
			;
		
			$GLOBALS['tmpl']->assign("now_vip_grade",$now_vip_grade);
	        
	        $can_buy_count = 0;
	        foreach($vip_list as $k=>$v){
	        	
	            if($v['sort'] > $now_vip_grade['sort']){
	                $can_buy_count ++;
	            }
				else{
					unset($vip_list[$k]);
				}
	        }
			
	        
	        $root["can_buy_count"] = VUC;
			$root["vip_list"] = $vip_list;
			
			$root["vip_data"] = json_encode($vip_list);
			
		}else{
			$root['status']=0;
			$root['response_code'] = 0;
			$root['show_err'] ="未登录";
			$root['user_login_status'] = 0;
		}
		$root['program_title'] = "VIP购买";
		output($root);		
	}
}
?>
